import http from "@/http";
import { DevicePricingPlan, DevicePricingQuery, DevicePricingCreateDTO, DevicePricingUpdateDTO } from './type';

// 分页查询设备核价列表
export const getDevicePricingListApi = (params: DevicePricingQuery) => {
  return http.get("/devicePricing/queryDevicePricingList", params);
};

// 根据ID获取设备核价详情
export const getDevicePricingDetailApi = (id: number | string) => {
  return http.get(`/devicePricing/getDevicePricingDetail/${id}`);
};

// 新增设备核价
export const addDevicePricingApi = (data: DevicePricingCreateDTO) => {
  return http.post("/devicePricing/addDevicePricing", data);
};

// 更新设备核价
export const updateDevicePricingApi = (data: DevicePricingUpdateDTO) => {
  return http.put("/devicePricing/updateDevicePricing", data);
};

// 删除设备核价
export const deleteDevicePricingApi = (id: number | string) => {
  return http.delete(`/devicePricing/deleteDevicePricing/${id}`);
};

// 获取堆垛机价格数据
export const getStackerPriceDataApi = () => {
  return http.post("/devicePricing/calculateStacker");
};

// 更新单个数值
export const updateDefaultValueApi = (data: any) => {
  return http.put("/devicePricing/updateDefaultValue", data);
};

/**
 * 计算堆垛机价格
 * @param data 堆垛机数据
 */
export function calculateStackerPricingApi(data: any) {
  return http.post("/devicePricing/calculateStacker", data);
}

// 更新设备核价状态
export const updateStatusApi = (params: { id: number; activate: number }) => {
  return http.put("/devicePricing/updateStatus", params);
}; 